<?php

/**
 * StormLevels filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseStormLevelsFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'SDESCRIPTION_ENG'   => new sfWidgetFormFilterInput(),
      'SDESCRIPTION_THAI'  => new sfWidgetFormFilterInput(),
      'ILOWER_BOUND_SPEED' => new sfWidgetFormFilterInput(),
      'IUPPER_BOUND_SPEED' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'SDESCRIPTION_ENG'   => new sfValidatorPass(array('required' => false)),
      'SDESCRIPTION_THAI'  => new sfValidatorPass(array('required' => false)),
      'ILOWER_BOUND_SPEED' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'IUPPER_BOUND_SPEED' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('storm_levels_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'StormLevels';
  }

  public function getFields()
  {
    return array(
      'ILEVEL'             => 'Number',
      'SDESCRIPTION_ENG'   => 'Text',
      'SDESCRIPTION_THAI'  => 'Text',
      'ILOWER_BOUND_SPEED' => 'Number',
      'IUPPER_BOUND_SPEED' => 'Number',
    );
  }
}
